package com.sq.springcloud.alibaba.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @Description: TODO
 * @author: ydy
 * @date: 2022-10-28 14:47
 */
@Configuration
public class ApplicationContextConfig {
    @Bean
    @LoadBalanced   //RestTemplate结合Ribbon做负载均衡时一定要加LoadBalance注解
    //负载均衡是因为Ribbon，Nacos只是做服务注册发现和统一配置中心
    public RestTemplate getRestTemplate() {
        return new RestTemplate();
    }
}
